
<html>
    <head>
        <meta charset="UTF-8">
        <title>RENDEZ-VOUS</title> 
       <link rel="stylesheet" href="../bootstrap/css/bootstrap.css"/> 
    </head>
    <body>
        <?php
       // Création de la connexion avec la base de donnée
        $host = "localhost";
        $user = "root";
        $password = "toto";
        $database = "carnet_adresses";
        $connexion = mysqli_connect($host, $user, $password, $database) ;
        
    if (mysqli_connect_errno())
            
            {
            echo ("Echec de la connexion : Erreur n°". mysqli_connect_errno()." / ". 

            mysqli_connect_error()); 
            } 
   // else 
   //      { 
   //          echo "Connexion au serveur MySQL OK !"; 
   //     }
        ?>
        <style>
            h2{
                 color : #58ACFA;
            }
        </style>
        <h2>LISTE DES RENDEZ VOUS</h2> <?php
$sql = "SELECT * FROM rendez_vous";
$envoi_requete = mysqli_query($connexion, $sql);


while($resultats = mysqli_fetch_assoc($envoi_requete)) {
?>
        
        <table class=" table table-bordered">
            
           <tr>
                <th class = active> N° </th>
                <td class="active"><?php echo $resultats["id"]?></td>
           </tr>
            
            <tr>
                <th> Contact </th>
                <td>
                <?php 
                        //REQUETE SQL
                        $sql_cont = "SELECT nom, prenom FROM contacts WHERE id=".$resultats["id"];
                        $req_cont = mysqli_query($connexion, $sql_cont);
                        $resultats_cont = mysqli_fetch_assoc($req_cont);
                        
                        echo $resultats_cont["nom"]." ".$resultats_cont["prenom"];
                        ?>            
                </td>
            </tr>
            
            <tr>
                <th> Date </th>
                <td> <?php echo $resultats["rdv_date"]?> </td>             
            </tr>
            
            
            <tr>
                <th>Heure</th>
                <td><?php echo $resultats["heure"]?></td>               
            </tr>
            
            <tr>
                <th> Type </th>
                <td> <?php echo $resultats["type_rdv"]?> </td>                    
            </tr>
            
            <tr>
                <th> Objet </th>
                <td> <?php echo $resultats["objet"]?> </td>      
            </tr>
            
             <tr>
                 <th> Observations </th>               
                 <td><?php echo $resultats["observations"]?></td>
             </tr>
             
             
        </table>     

<?php

}

        ?>
    </body>
</html>


